Android
Signature
Explore example code
Browse the RefinementList example code on GitHub.
About this widget
RefinementList is a filtering view that displays facets
and lets users refine their search results by filtering on specific values.
Requirements
Theattribute provided to the widget must be in attributes for faceting,
either on the dashboard or using the attributesForFaceting parameter with the API.
Examples
Kotlin
Low-level API
If you want to fully control theRefinementList components and connect them manually, use the following components:
FilterState. The current state of the filters.FacetListViewModel. The logic applied to the facets.FacetListView. The view that renders facets.FacetListPresenter. Optional. The presenter that controls the sorting and other settings of the facet list view.
Kotlin
Compose UI
InstantSearch provides theFacetListState as a state model,
which is an implementation of the FacetListView interface.
You need to connect FacetListState to the FacetListConnector or FacetListViewModel like any other FacetListView implementation.
Kotlin
Parameters
The
FilterState that holds your filters.The attribute to filter.
Whether the list can have
Single or Multiple selections.If specified, the default facet values to display.
When true, the selection will be kept even if it does not match current results anymore.
Filters operator, which can either be
FilterOperator.And or FilterOperator.Or.Use filters or facet filters for more complex result refinement.View
The view that renders the facets.
The presenter that controls the sorting and other settings of the facet list view.
Kotlin
Presenter
How to sort facets. Must be one or more of the following values:
FacetSortCriterion.IsRefinedFacetSortCriterion.CountAscendingFacetSortCriterion.CountDescendingFacetSortCriterion.AlphabeticalAscendingFacetSortCriterion.AlphabeticalDescending
Kotlin
The number of facet values to retrieve.
Kotlin